<link rel="stylesheet" href="<?php echo Yii::app()->request->baseUrl; ?>/assets/jqg/css/style.css" />
<link rel="stylesheet" href="<?php echo Yii::app()->request->baseUrl; ?>/assets/jqg/css/popover.css" />
<script type="text/javascript" src="<?php echo Yii::app()->request->baseUrl; ?>/assets/jqg/js/jquery.fn.gantt.js"></script>
<script type="text/javascript" src="<?php echo Yii::app()->request->baseUrl; ?>/assets/jqg/js/bootstrap-tooltip.js"></script>
<script type="text/javascript" src="<?php echo Yii::app()->request->baseUrl; ?>/assets/jqg/js/bootstrap-popover.js"></script>
<script type="text/javascript" src="<?php echo Yii::app()->request->baseUrl; ?>/assets/jqg/js/prettify.js"></script>
<?php echo $this->renderPartial('menu_proyectos'); ?>

<div class="dvDetallesProyectos">
    <h2 style="padding: 0px; margin: 0px;">Proyecto: <?php echo $proyecto->idProyecto; ?></h2>
    <div id="dvTablaProyectos" style="width: 100%; border: none; min-height: 100px; min-width: 700px;">
        <table>
            <tr>
                <td>
                    <b><?php echo CHtml::encode($proyecto->getAttributeLabel('idProyecto')); ?>:</b>
                    <?php echo CHtml::encode($proyecto->idProyecto); ?>
                </td>
                <td colspan="2">
                    <b><?php echo CHtml::encode($proyecto->getAttributeLabel('descripcion')); ?>:</b>
                    <?php echo CHtml::encode($proyecto->descripcion); ?>
                </td>
                <td>
                    <b><?php echo CHtml::encode($proyecto->getAttributeLabel('obra')); ?>:</b>
                    <?php echo CHtml::encode($proyecto->obra); ?>
                </td>
            </tr>
            <tr>
                <td>
                    <b><?php echo CHtml::encode($proyecto->getAttributeLabel('sucursal')); ?>:</b>
                    <?php echo CHtml::encode($proyecto->sucursal); ?>
                </td>
                <td>
                    <b><?php echo CHtml::encode($proyecto->getAttributeLabel('tipo')); ?>:</b>
                    <?php echo CHtml::encode($proyecto->tipo); ?>
                </td>
                <td>
                    <b><?php echo CHtml::encode($proyecto->getAttributeLabel('proveedor')); ?>:</b>
                    <?php echo CHtml::encode($proyecto->proveedor); ?>
                </td>
                <td>
                    <b><?php echo CHtml::encode($proyecto->getAttributeLabel('noEconomico')); ?>:</b>
                    <?php echo CHtml::encode($proyecto->noEconomico); ?>
                </td>
            </tr>
            <tr>
                <td>
                    <b><?php echo CHtml::encode($proyecto->getAttributeLabel('fechaDeInicio')); ?>:</b>
                    <?php echo CHtml::encode($proyecto->fechaDeInicio); ?>
                </td>
                <td>
                    <b><?php echo CHtml::encode($proyecto->getAttributeLabel('fechaDeTerminacion')); ?>:</b>
                    <?php echo CHtml::encode($proyecto->fechaDeTerminacion); ?>
                </td>
                <td>
                    <b><?php echo CHtml::encode($proyecto->getAttributeLabel('presupuestoBase')); ?>:</b>
                    <?php echo CHtml::encode($proyecto->presupuestoBase); ?>
                </td>
                <td>
                    <b><?php echo CHtml::encode($proyecto->getAttributeLabel('coordinador')); ?>:</b>
                    <?php echo CHtml::encode($proyecto->coordinador); ?>
                </td>
            </tr>
        </table>
        <div id="tabsDetalle">
            <ul>
                <li><a href="#programa">Programación</a></li>
                <li><a href="#tab2">Tab 2</a></li>
                <li><a href="#tab3">Tab 3</a></li>
                <li><a href="#opciones">Opciones</a></li>
            </ul>
            <div id="programa">
                <div class="gantt"></div>
            </div>
            <div id="tab2">Otro Hola Mundo pero en jQueryUI</div>
            <div id="tab3">Lorem ipsum</div>
            <div id="opciones">
                <?php
                $form = $this->beginWidget('CActiveForm', array(
                    'id' => 'cargaRubro-form',
                    'action' => Yii::app()->createUrl('/proyectos/ajaxVerRubro', array('idu' => Yii::app()->user->id, 'hash' => Yii::app()->user->hash)),
                    'enableAjaxValidation' => false,
                        ));
                ?>
                <fieldset >
                    <legend>Carga de rubros...</legend>
                    <div class="row">
                        <label>Selecciona un rubro: </label>
                        <?php echo CHtml::activeDropDownList($cargaRubro, 'idListadoRubro', CHtml::listData(ProyectosListadoRubro::model()->findAll(), 'idListadoRubro', 'rubro', ''), array('class' => 'inputText')); ?>
                        <?php echo $form->error($cargaRubro, 'idListadoRubro'); ?>
                        <?php echo CHtml::submitButton($cargaRubro->isNewRecord ? 'Ver opciones' : 'Error'); ?>
                    </div>
                </fieldset>
                <?php $this->endWidget(); ?>

            </div>
        </div>
    </div>
</div>
<script type="text/javascript">

    jQuery(function(){
        jQuery("#tabsDetalle").tabs();
        ajaxSubmitBoton("cargaRubro",'<?php echo $proyecto->idProyecto; ?>');
        
        "use strict";
        
        jQuery(".gantt").gantt({
            source: [{
                    name: "Sprint 0",
                    desc: "Analysis",
                    values: [{
                            from: "/Date(1320192000000)/",
                            to: "/Date(1322401600000)/",
                            label: "Requirement Gathering", 
                            customClass: "ganttRed",
                            dataObj : "aa"
                        }]
                },{
                    name: " ",
                    desc: "Scoping",
                    values: [{
                            from: "/Date(1322611200000)/",
                            to: "/Date(1323302400000)/",
                            label: "Scoping", 
                            customClass: "ganttRed"
                        }]
                },{
                    name: "Sprint 1",
                    desc: "Development",
                    values: [{
                            from: "/Date(1323802400000)/",
                            to: "/Date(1325685200000)/",
                            label: "Development", 
                            customClass: "ganttGreen"
                        }]
                },{
                    name: " ",
                    desc: "Showcasing",
                    values: [{
                            from: "/Date(1325685200000)/",
                            to: "/Date(1325695200000)/",
                            label: "Showcasing", 
                            customClass: "ganttBlue"
                        }]
                },{
                    name: "Sprint 2",
                    desc: "Development",
                    values: [{
                            from: "/Date(1326785200000)/",
                            to: "/Date(1325785200000)/",
                            label: "Development", 
                            customClass: "ganttGreen"
                        }]
                },{
                    name: " ",
                    desc: "Showcasing",
                    values: [{
                            from: "/Date(1328785200000)/",
                            to: "/Date(1328905200000)/",
                            label: "Showcasing", 
                            customClass: "ganttBlue"
                        }]
                },{
                    name: "Release Stage",
                    desc: "Training",
                    values: [{
                            from: "/Date(1330011200000)/",
                            to: "/Date(1336611200000)/",
                            label: "Training", 
                            customClass: "ganttOrange"
                        }]
                },{
                    name: " ",
                    desc: "Deployment",
                    values: [{
                            from: "/Date(1336611200000)/",
                            to: "/Date(1338711200000)/",
                            label: "Deployment", 
                            customClass: "ganttOrange"
                        }]
                },{
                    name: " ",
                    desc: "Warranty Period",
                    values: [{
                            from: "/Date(1336611200000)/",
                            to: "/Date(1349711200000)/",
                            label: "Warranty Period", 
                            customClass: "ganttOrange"
                        }]
                }],
            navigate: "scroll",
            scale: "days",
            maxScale: "months",
            minScale: "days",
            itemsPerPage: 10,
            onItemClick: function(data) {
                alert("Item clicked - show some details " + data);
            },
            onAddClick: function(dt, rowId) {
                alert("Empty space clicked - add an item!" + dt + rowId);
            },
            onRender: function() {
                if (window.console && typeof console.log === "function") {
                    console.log("chart rendered");
                }
            }
        });

        prettyPrint();
    });
    

    

</script>